package com.smarthospital.common.Result;

/**
 * create by sym  2021/3/24 20:50.
 */
public class CommonException extends RuntimeException {
    private Integer code;
    private String msg;

    public CommonException(String msg) {
        this.code =CodeMsg.FAIL.getCode();
        this.msg = msg;
    }
    public CommonException(CodeMsg codeMsg) {
        this.code = codeMsg.getCode();
        this.msg = codeMsg.getMsg();
    }

    public CommonException(CodeMsg codeMsg,String msg) {
        this.code = codeMsg.getCode();
        this.msg = msg;
    }
    public CommonException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public CommonException(String message, Integer code, String msg) {
        super(message);
        this.code = code;
        this.msg = msg;
    }

    public CommonException(String message, Throwable cause, Integer code, String msg) {
        super(message, cause);
        this.code = code;
        this.msg = msg;
    }

    public CommonException(Throwable cause, Integer code, String msg) {
        super(cause);
        this.code = code;
        this.msg = msg;
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "CommonException{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}
